@ GNU AS assembler header file for DeviceFS
@ Written by DefMod (Dec  9 2012) on Sun Dec  9 15:47:15 2012
@ Jonathan Coxhead, jonathan@doves.demon.co.uk, 29 June 1995

@ OSLib---efficient, type-safe, transparent, extensible,
@ register-safe API coverage of RISC OS
@ 
@ Copyright (c) 1994-2012 Jonathan Coxhead and OSLib maintainers
@ 
@ Licence:
@ 
@    OSLib is free software; you can redistribute it and/or modify
@ it under the terms of the GNU General Public License as published by
@ the Free Software Foundation; either version 1, or (at your option)
@ any later version - and this with the following clarification and
@ special exception:
@ 
@    Linking this library statically or dynamically with other modules
@ is making a combined work based on this library. Thus, the terms
@ and conditions of the GNU General Public License cover the whole
@ combination.
@ 
@    As a special exception, the copyright holders of this library
@ give you permission to link this library with independent modules
@ to produce an executable, regardless of the license terms of these
@ independent modules, and to copy and distribute the resulting
@ executable under terms of your choice, provided that you also meet,
@ for each linked independent module, the terms and conditions of the
@ license of that module. An independent module is a module which is
@ not derived from or based on this library. If you modify this
@ library, you may extend this exception to your version of the library,
@ but you are not obliged to do so. If you do not wish to do so, delete
@ this exception statement from your version.
@ 
@    OSLib is distributed in the hope that it will be useful,
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@ GNU General Public License for more details.
@ 
@    You should have received a copy of the GNU General Public License
@ along with this programme; if not, write to the Free Software
@ Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, USA.

#ifndef DeviceFS_Hdr
#  define DeviceFS_Hdr

#  ifndef Get_Types
#    define Get_Types
#    include "oslib/Types.Hdr"
#  endif

#  ifndef Get_OS
#    define Get_OS
#    include "oslib/OS.Hdr"
#  endif

#  ifndef Get_OSArgs
#    define Get_OSArgs
#    include "oslib/OSArgs.Hdr"
#  endif

#  ifndef Get_Buffer
#    define Get_Buffer
#    include "oslib/Buffer.Hdr"
#  endif

@Symbols for constants
#  define DeviceFS_DeviceBuffered 0x1
#  define DeviceFS_DeviceUsesPathVar 0x2
#  define DeviceFS_RegisterBlockDevice 0x1
#  define DeviceFS_RegisterFullDuplex 0x2
#  define DeviceFS_OpenForRx 0x0
#  define DeviceFS_OpenForTx 0x1

@Symbols for structure offsets and sizes
        .struct 0
        .skip   Bits
DeviceFS_Flags                 : 

@ abstract type
#  define DeviceFS_D 4

@ abstract type
#  define DeviceFS_S 4

@ abstract type
#  define DeviceFS_H 4

        .struct 0
DeviceFS_Device_name_offset    : .skip   Int
DeviceFS_Device_flags          : .skip   DeviceFS_Flags
DeviceFS_Device_rx_flags       : .skip   Bits
DeviceFS_Device_rx_buffer_size : .skip   Int
DeviceFS_Device_tx_flags       : .skip   Bits
DeviceFS_Device_tx_buffer_size : .skip   Int
DeviceFS_Device_reserved       : .skip   Int
DeviceFS_Device                : 

        .struct 0
DeviceFS_DeviceList_d          : .skip   DeviceFS_Device
DeviceFS_DeviceList            : 

        .struct 0
        .skip   Bits
DeviceFS_RegisterFlags         : 

        .struct 0
        .skip   Bits
DeviceFS_InitialiseFlags       : 


@Symbols for SWI's and SWI reason codes
.set XDeviceFS_Register,0x62740
.set DeviceFS_Register,0x42740
   @Entry
   @  R0 = flags (DeviceFS_RegisterFlags)
   @  R1 -> devices (DeviceFS_DeviceList)
   @  R2 = driver (pointer to code)
   @  R3 = handle (Int)
   @  R4 = workspace (pointer to Void)
   @  R5 -> validation (String)
   @  R6 = rx_limit (Int)
   @  R7 = tx_limit (Int)
   @Exit
   @  R0 = d (DeviceFS_D)

.set XDeviceFS_Deregister,0x62741
.set DeviceFS_Deregister,0x42741
   @Entry
   @  R0 = d (DeviceFS_D)

.set XDeviceFS_RegisterObjects,0x62742
.set DeviceFS_RegisterObjects,0x42742
   @Entry
   @  R0 = d (DeviceFS_D)
   @  R1 -> devices (DeviceFS_DeviceList)

.set XDeviceFS_DeregisterObjects,0x62743
.set DeviceFS_DeregisterObjects,0x42743
   @Entry
   @  R0 = d (DeviceFS_D)
   @  R1 -> device_name (String)

.set XDeviceFS_CallDevice,0x62744
.set DeviceFS_CallDevice,0x42744

#  define DeviceFSCallDevice_Initialise 0x0
   @Entry
   @  R0 = &0
   @  R1 = d (DeviceFS_D)
   @  R2 = s (DeviceFS_S)
   @  R3 = flags (DeviceFS_InitialiseFlags)
   @  R6 -> decoded_special (data)
   @Exit
   @  R2 = h (DeviceFS_H)

#  define DeviceFSCallDevice_Terminate 0x1
   @Entry
   @  R0 = &1
   @  R1 = d (DeviceFS_D)
   @  R2 = h (DeviceFS_H)

#  define DeviceFSCallDevice_TxWakeUp 0x2
   @Entry
   @  R0 = &2
   @  R1 = d (DeviceFS_D)
   @  R2 = h (DeviceFS_H)
   @Exit
   @  R0 = woken_up (Bool)

#  define DeviceFSCallDevice_RxWakeUp 0x3
   @Entry
   @  R0 = &3
   @  R1 = d (DeviceFS_D)
   @  R2 = h (DeviceFS_H)

#  define DeviceFSCallDevice_RxSleep 0x4
   @Entry
   @  R0 = &4
   @  R1 = d (DeviceFS_D)
   @  R2 = h (DeviceFS_H)

#  define DeviceFSCallDevice_EnumDir 0x5
   @Entry
   @  R0 = &5
   @  R1 = d (DeviceFS_D)
   @  R2 -> file_name (String)

#  define DeviceFSCallDevice_TxCreateBuffer 0x6
   @Entry
   @  R0 = &6
   @  R1 = d (DeviceFS_D)
   @  R2 = h (DeviceFS_H)
   @  R3 = flags (Buffer_Flags)
   @  R4 = size (Int)
   @  R5 = b (Buffer_B)
   @  R6 = threshold (Int)
   @Exit
   @  R3 = flags_out (Buffer_Flags)
   @  R4 = size_out (Int)
   @  R5 = b_out (Buffer_B)
   @  R6 = threshold_out (Int)

#  define DeviceFSCallDevice_RxCreateBuffer 0x7
   @Entry
   @  R0 = &7
   @  R1 = d (DeviceFS_D)
   @  R2 = h (DeviceFS_H)
   @  R3 = flags (Buffer_Flags)
   @  R4 = size (Int)
   @  R5 = b (Buffer_B)
   @  R6 = threshold (Int)
   @Exit
   @  R3 = flags_out (Buffer_Flags)
   @  R4 = size_out (Int)
   @  R5 = b_out (Buffer_B)
   @  R6 = threshold_out (Int)

#  define DeviceFSCallDevice_Halt 0x8
   @Entry
   @  R0 = &8
   @  R1 = d (DeviceFS_D)
   @  R2 = h (DeviceFS_H)

#  define DeviceFSCallDevice_Resume 0x9
   @Entry
   @  R0 = &9
   @  R1 = d (DeviceFS_D)
   @  R2 = h (DeviceFS_H)

#  define DeviceFSCallDevice_EndOfData 0xa
   @Entry
   @  R0 = &A
   @  R1 = d (DeviceFS_D)
   @  R2 = h (DeviceFS_H)
   @  R3 = &FFFFFFFF
   @Exit
   @  R3 = end_of_data (Bool)

#  define DeviceFSCallDevice_StreamCreated 0xb
   @Entry
   @  R0 = &B
   @  R1 = d (DeviceFS_D)
   @  R2 = h (DeviceFS_H)
   @  R3 = b (Buffer_B)

#  define DeviceFSCallDevice_IOCtl 0xe
   @Entry
   @  R0 = &E
   @  R1 = d (DeviceFS_D)
   @  R2 = h (DeviceFS_H)
   @  R3 = parameters (pointer to OSArgs_IOCtlParameters)

.set XDeviceFS_Threshold,0x62745
.set DeviceFS_Threshold,0x42745
   @Entry
   @  R1 = s (DeviceFS_S)
   @  R2 = threshold (Int)

.set XDeviceFS_ReceivedChar,0x62746
.set DeviceFS_ReceivedChar,0x42746
   @Entry
   @  R0 = b (Byte)
   @  R1 = s (DeviceFS_S)

.set XDeviceFS_TransmitChar,0x62747
.set DeviceFS_TransmitChar,0x42747
   @Entry
   @  R1 = s (DeviceFS_S)
   @Exit
   @  R0 = b (Byte)

#  define Service_DeviceFSStarting 0x70
   @Entry
   @  R1 = &70

#  define Service_DeviceFSDying 0x71
   @Entry
   @  R0 = &0
   @  R1 = &71

#  define Service_DeviceDead 0x79
   @Entry
   @  R0 = &0
   @  R1 = &79
   @  R2 = d (DeviceFS_D)
   @  R3 -> device_name (String)

#  define Service_DeviceFSCloseRequest 0x81
   @Entry
   @  R1 = &81
   @  R2 = file (OS_F)
   @Exit
   @  R1 = unclaimed (Bool)

#  define Service_DeviceFSCloseRequestW 0x81
   @Entry
   @  R1 = &81
   @  R2 = file (OS_FW)
   @Exit
   @  R1 = unclaimed (Bool)

#  define UpCall_StreamCreated 0xa
   @Entry
   @  R0 = &A
   @  R1 = d (DeviceFS_D)
   @  R2 = tx_stream (Bool)
   @  R3 = file (OS_F)
   @  R4 = s (DeviceFS_S)

#  define UpCall_StreamCreatedW 0xa
   @Entry
   @  R0 = &A
   @  R1 = d (DeviceFS_D)
   @  R2 = tx_stream (Bool)
   @  R3 = file (OS_FW)
   @  R4 = s (DeviceFS_S)

#  define UpCall_StreamClosed 0xb
   @Entry
   @  R0 = &B
   @  R1 = d (DeviceFS_D)
   @  R2 = tx_stream (Bool)
   @  R3 = file (OS_F)
   @  R4 = s (DeviceFS_S)

#  define UpCall_StreamClosedW 0xb
   @Entry
   @  R0 = &B
   @  R1 = d (DeviceFS_D)
   @  R2 = tx_stream (Bool)
   @  R3 = file (OS_FW)
   @  R4 = s (DeviceFS_S)

#  define UpCall_DeviceRxDataPresent 0xf
   @Entry
   @  R0 = &F
   @  R1 = d (DeviceFS_D)

#  define UpCall_DeviceThresAbove 0x10
   @Entry
   @  R0 = &10
   @  R1 = d (DeviceFS_D)

#  define UpCall_DeviceThresBelow 0x11
   @Entry
   @  R0 = &11
   @  R1 = d (DeviceFS_D)

#  define Event_DeviceOverrun 0x16
   @Entry
   @  R0 = &16
   @  R1 = d (DeviceFS_D)
   @  R2 = file (OS_F)
   @  R3 = &0

#  define Event_DeviceOverrunW 0x16
   @Entry
   @  R0 = &16
   @  R1 = d (DeviceFS_D)
   @  R2 = file (OS_FW)
   @  R3 = &0

#endif
